#include <gtest/gtest.h>
#include <chrono>
#include <string>
#include <thread>
#include <cstdlib>
#include "log/zuclog.h"
#include "log/datacollector.hh"

void GtestLogSleep(uint64_t ms) { std::this_thread::sleep_for(std::chrono::milliseconds(ms)); }

class LogTestEnvironment : public ::testing::Environment
{
public:
    void SetUp() override { EXPECT_EQ(zucDiagInit(), 0); }

    void TearDown() override { EXPECT_EQ(zucDiagDeInit(), 0); }
};

int main(int argc, char* argv[])
{
    zucLogInit();
    zucEnableStdout(1);

    testing::InitGoogleTest(&argc, argv);
    testing::AddGlobalTestEnvironment(new LogTestEnvironment);
    // RUN_ALL_TESTS 也应为 gtest.h 的内部宏
    return RUN_ALL_TESTS();
}